<!DOCTYPE html>
<html >
<head lang="en">
    <meta charset="UTF-8">
    <title>出租车计费</title>
</head>
<body>
<script language="Javascript">
    function rec(form){

        var t=parseInt(form.th1.value);
        var x=parseInt(form.th2.value);

        if(t>=6&&t<=21){
            if(x<=2){
                form.th3.value=7;}

            else{ form.th3.value=(7+(x-2)*1.5);}
        }
        else{ if(x<=2){
            form.th3.value=8;
        }
        else{ form.th3.value=(8+(x-2)*1.5);}


        }

    }

·

</script>



<form action="">
    <h1>城市出租车计费</h1>
    <blockquote>

        时间：
        <input type="text" name="th1" value=""><br>
        公里数：
        <input type="text" name="th2" value=""><br>


        <input type="button" name="button" onClick="rec(this.form)" value="您所要支付的费用" >

        <input type="text" name="th3" value=""><br>



    </blockquote>
</form>
</body>
</html>